/* GUI CONVERTED from rwroup.p (converter v1.76) Mon Sep 17 22:18:47 2001 */
/* rwroup.p - UPDATE ROUTING DATA WITH NEW STANDARD OP / WORK CENTER DATA*/
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                   */
/* All rights reserved worldwide.  This is an unpublished work.          */
/* $Revision: 1.6.1.6 $                                                    */
/*V8:ConvertMode=FullGUIReport                                           */
/* REVISION: 5.0      LAST MODIFIED: 04/08/91   BY: emb       */
/* REVISION: 5.0      LAST MODIFIED: 05/09/91   BY: emb *B939**/
/* REVISION: 6.0      LAST MODIFIED: 10/11/91   BY: emb *D896**/
/* REVISION: 7.0      LAST MODIFIED: 04/03/92   BY: emb *F354**/
/* REVISION: 7.3      LAST MODIFIED: 06/27/96   *G1YR*   BY:Russ Witt        */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane         */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan        */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan        */
/* REVISION: 8.6E     LAST MODIFIED: 02/16/99   BY: *J3B8* Prashanth Narayan */
/* REVISION: 9.1      LAST MODIFIED: 08/30/99   BY: *N01B* Mugdha Tambe      */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane  */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb               */
/* Old ECO marker removed, but no ECO header exists *F0PN*                   */
/* Revision: 1.6.1.5     BY: Hualin Zhong   DATE: 05/08/01 ECO: *N0YC*       */
/* $Revision: 1.6.1.6 $    BY: Manjusha Inglay   DATE: 08/28/01 ECO: *P01R* */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* DISPLAY TITLE */

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rwroup_p_2 "Run!Crew"
/* MaxLen: Comment: */

&SCOPED-DEFINE rwroup_p_3 "Setup!Crew"
/* MaxLen: Comment: */

&SCOPED-DEFINE rwroup_p_5 "New Work Center Data"
/* MaxLen: Comment: */

&SCOPED-DEFINE rwroup_p_7 "New Standard Operation Data"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

define variable routing like ro_routing.
define variable routing1 like ro_routing.
define variable op like ps_op.
define variable op1 like ps_op.
define variable wkctr like ro_wkctr.
define variable wkctr1 like ro_wkctr.
define variable mch   like ro_mch.
define variable mch1  like ro_mch.
define variable std_op like ro_std_op.
define variable std_op1 like ro_std_op.
define variable display_wc like mfc_logical initial true
   label {&rwroup_p_5}.
define variable display_std_op like mfc_logical initial true
   label {&rwroup_p_7}.
define variable update_wc like mfc_logical.
define variable update_std_op like mfc_logical.
define variable new_data as character.
define variable star as character initial "*" format "x(1)".
define variable rodet_recid as recid.

define variable desc1 as character format "x(49)".
define variable l_display as character format "x(9)" no-undo.
define variable l_update as character format "x(9)" no-undo.
define variable l_new_wc as character format "x(26)" no-undo.
define variable l_std_op as character format "x(36)" no-undo.
define variable l_std_sim as character format "x(26)" no-undo.
define variable l_wc_sim as character format "x(26)" no-undo.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
routing        colon 22
   routing1       colon 49 label {t001.i}
   op             colon 22
   op1            colon 49 label {t001.i}
   wkctr          colon 22
   wkctr1         colon 49 label {t001.i}
   mch            colon 22
   mch1           colon 49 label {t001.i}
   std_op         colon 22
   std_op1        colon 49 label {t001.i}
   skip(1)
   l_display      no-label at 30 l_update      at 41 no-label
   display_std_op colon 30       update_std_op at 43 no-label
   display_wc     colon 30       update_wc     at 43 no-label
 SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

/* FACILITATING SIMULATION PRINTING FOR INPUT FLAGS     */
/* New Work Center Data AND New Standard Operation Data */
FORM /*GUI*/ 
   l_std_op no-label to 52 /* New Standard Operation Data */
   l_std_sim no-label at 54
with STREAM-IO /*GUI*/  frame std_op_sim width 80 no-box page-top .

FORM /*GUI*/ 
   l_new_wc no-label to 52 /* NEW WORK CENTER DATA */
   l_wc_sim no-label at 54
with STREAM-IO /*GUI*/  frame wc_sim width 80 no-box page-top .

assign
   l_display:screen-value = getTermLabel("DISPLAY",9)
   l_update:screen-value = getTermLabel("UPDATE",9)
   l_new_wc:screen-value = getTermLabelRt("NEW_WORK_CENTER_DATA",26)
   l_std_op:screen-value = getTermLabelRt("NEW_STANDARD_OPERATION_DATA",36)
   l_std_sim:screen-value = "- " + getTermLabel("BANNER_SIMULATION",26)
   l_wc_sim:screen-value = "- " + getTermLabel("BANNER_SIMULATION",26)
   new_data = getTermLabelRtColon("NEW",8).


/*GUI*/ {mfguirpa.i true "printer" 132 " " " " " "  }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:


   if routing1 = hi_char then routing1 = "".
   if op1 = 999999999 then op1 = 0.
   if wkctr1 = hi_char then wkctr1 = "".
   if mch1 = hi_char then mch1 = "".
   if std_op1 = hi_char then std_op1 = "".

   
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


   bcdparm = "".
   {mfquoter.i routing   }
   {mfquoter.i routing1  }
   {mfquoter.i op     }
   {mfquoter.i op1    }
   {mfquoter.i wkctr  }
   {mfquoter.i wkctr1 }
   {mfquoter.i mch    }
   {mfquoter.i mch1   }
   {mfquoter.i std_op }
   {mfquoter.i std_op1}
   {mfquoter.i display_std_op}
   {mfquoter.i update_std_op }
   {mfquoter.i display_wc}
   {mfquoter.i update_wc}

   if  routing1 = "" then routing1 = hi_char.
   if  op1 = 0 then op1 = 999999999.
   if  wkctr1 = "" then wkctr1 = hi_char.
   if  mch1 = "" then mch1 = hi_char.
   if  std_op1 = "" then std_op1 = hi_char.

   /* OUTPUT DESTINATION SELECTION */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i "printer" 132 " " " " " " " " }
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:

define buffer rodet for ro_det.


   {mfphead.i}

   if not update_std_op then view frame std_op_sim  .
   if not update_wc then view frame wc_sim      .

   for each ro_det no-lock where
         (ro_routing >= routing and ro_routing <= routing1)
         and (ro_op >= op and ro_op <= op1)
         and (ro_wkctr >= wkctr and ro_wkctr <= wkctr1)
         and (ro_mch >= mch and ro_mch <= mch1)
         and (ro_std_op >= std_op and ro_std_op <= std_op1)
         break by ro_routing by ro_op
      with frame b width 134 no-attr-space down:

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame b:handle).

      do with frame d:
         /* SET EXTERNAL LABELS */
         setFrameLabels(frame d:handle).
         if first-of(ro_routing) then do:

            if page-size - line-counter < 11 then page.

            display ro_routing
            with frame d side-labels width 132 no-attr-space page-top STREAM-IO /*GUI*/ .

            find pt_mstr where pt_part = ro_routing no-lock no-error.
            if available pt_mstr and
               (pt_routing = "" or pt_routing = pt_part)
            then
               display pt_desc1 + " " + pt_desc2 @ desc1 no-label
               with frame d STREAM-IO /*GUI*/ .
         end.

         if page-size - line-counter < 9 then do:
            page.
            display ro_routing
              "(" + getTermLabel("CONTINUE",6) + ".)" @ desc1 with frame d STREAM-IO /*GUI*/ .
         end.
      end. /* do with */

      display
         ro_op
         ro_std_op
         ro_desc
         ro_setup
         ro_run
         ro_move
         ro_tran_qty
         ro_sub_lead
         ro_yield_pct
         ro_tool
         ro_vend
         ro_sub_cost
      with frame b STREAM-IO /*GUI*/ .

      if update_std_op or update_wc then do for rodet:
            rodet_recid = recid(ro_det).
            find rodet exclusive-lock where recid(rodet) = rodet_recid.
         end.

         find opm_mstr no-lock where opm_std_op = ro_std_op no-error.
         if available opm_mstr then do:

            if display_std_op
               and (opm_desc <> ro_desc
               or opm_tran_qty <> ro_tran_qty
               or opm_sub_lead <> ro_sub_lead
               or opm_setup <> ro_setup
               or opm_run <> ro_run
               or opm_move <> ro_move
               or opm_yld_pct <> ro_yield_pct
               or opm_tool <> ro_tool
               or opm_vend <> ro_vend
               or opm_sub_cost <> ro_sub_cost)
               then do with frame b:

               down 1.

               display
                  opm_desc when (opm_desc <> ro_desc) @ ro_desc
                  opm_tran_qty when (opm_tran_qty <> ro_tran_qty)
                  @ ro_tran_qty
                  opm_sub_lead when (opm_sub_lead <> ro_sub_lead)
                  @ ro_sub_lead
                  opm_setup when (opm_setup <> ro_setup) @ ro_setup
                  opm_run when (opm_run <> ro_run) @ ro_run
                  opm_move when (opm_move <> ro_move) @ ro_move
                  opm_yld_pct when (opm_yld_pct <> ro_yield_pct)
                  @ ro_yield_pct
                  opm_tool when (opm_tool <> ro_tool) @ ro_tool
                  opm_vend when (opm_vend <> ro_vend) @ ro_vend
                  opm_sub_cost when (opm_sub_cost <> ro_sub_cost)
                  @ ro_sub_cost WITH STREAM-IO /*GUI*/ .

               display new_data @ ro_std_op star no-label WITH STREAM-IO /*GUI*/ .

            end.

         end.

         do with frame c:
            /* SET EXTERNAL LABELS */
            setFrameLabels(frame c:handle).
            display space(62)
               "" @ new_data no-label
               ro_wkctr ro_mch ro_mch_op
               ro_queue ro_wait
               ro_men_mch column-label {&rwroup_p_2} format ">>9.99"
               ro_setup_men column-label {&rwroup_p_3} format ">>9.99"
            with frame c width 133 no-attr-space down STREAM-IO /*GUI*/ .

            if (display_std_op or update_std_op)
               and available opm_mstr
               and (opm_wkctr <> ro_wkctr or opm_mch <> ro_mch)
               then
               find wc_mstr no-lock where wc_wkctr = opm_wkctr
                  and wc_mch = opm_mch no-error.
            else
               find wc_mstr no-lock where wc_wkctr = ro_wkctr
                  and wc_mch = ro_mch no-error.

            if available wc_mstr then do:

               if display_wc
                  and ((available opm_mstr and opm_wkctr <> ro_wkctr and
                  display_std_op)
                  or (available opm_mstr and opm_mch <> ro_mch and
                  display_std_op)
                  or wc_mch_op <> ro_mch_op
                  or wc_queue <> ro_queue
                  or wc_wait <> ro_wait
                  or wc_men_mch <> ro_men_mch
                  or wc_setup_men <> ro_setup_men)
                  then do with frame c:

                  down 1.

                  display
                     opm_wkctr when (available opm_mstr
                     and opm_wkctr <> ro_wkctr
                     and display_std_op) @ ro_wkctr
                     opm_mch when (available opm_mstr
                     and opm_mch <> ro_mch
                     and display_std_op) @ ro_mch
                     wc_mch_op when (wc_mch_op <> ro_mch_op) @ ro_mch_op
                     wc_queue when (wc_queue <> ro_queue) @ ro_queue
                     wc_wait when (wc_wait <> ro_wait) @ ro_wait
                     wc_men_mch when (wc_men_mch <> ro_men_mch) @ ro_men_mc
                     wc_setup_men when (wc_setup_men <> ro_setup_men)
                     @ ro_setup_men WITH STREAM-IO /*GUI*/ .

                  display new_data star no-label WITH STREAM-IO /*GUI*/ .
               end.
            end.
         end. /* do with */

         if update_std_op and available opm_mstr then
            assign
               ro_desc = opm_desc
               ro_wkctr = opm_wkctr
               ro_mch = opm_mch
               ro_tran_qty = opm_tran_qty
               ro_sub_lead = opm_sub_lead
               ro_setup = opm_setup
               ro_run = opm_run
               ro_cyc_rate = if opm_run <> 0 then (1 / opm_run)
                             else 0
               ro_move = opm_move
               ro_yield_pct = opm_yld_pct
               ro_tool = opm_tool
               ro_vend = opm_vend
               ro_sub_cost = opm_sub_cost.

         if update_wc and available wc_mstr then
            assign
               ro_mch_op = wc_mch_op
               ro_queue = wc_queue
               ro_wait = wc_wait
               ro_men_mch = wc_men_mch
               ro_setup_men = wc_setup_men.

         
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/

      end.

      /* REPORT TRAILER  */
      
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


   end.

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" routing routing1 op op1 wkctr wkctr1 mch mch1 std_op std_op1 display_std_op update_std_op display_wc update_wc "} /*Drive the Report*/
